import "./style.css"
import imgObj from './images/logo.png'

const img=document.createElement('img')
img.src=imgObj
img.style.width='30px'
img.style.height='30px'

loginForm.appendChild(img)



const loginForm = document.getElementById('loginForm');
document.addEventListener('DOMContentLoaded', () => {
    const messageEl = document.getElementById('message');
    
    loginForm.addEventListener('submit', (e) => {
        e.preventDefault(); // 阻止表单默认提交行为
        
        // 获取输入值
        const username = document.getElementById('username').value.trim();
        const password = document.getElementById('password').value;
        
        // 简单验证
        if (!username || !password) {
            showMessage('用户名和密码不能为空', 'error');
            return;
        }
        
        // 模拟登录验证（实际项目中应发送到服务器）
        if (username === 'admin' && password === '123456') {
            showMessage('登录成功！正在跳转...', 'success');
            // 实际项目中这里会有页面跳转
            setTimeout(() => {
                alert(`欢迎回来，${username}！`);
            }, 1000);
        } else {
            showMessage('用户名或密码错误', 'error');
        }
    });
    
    function showMessage(text, type) {
        messageEl.textContent = text;
        messageEl.className = `message ${type}`;
        
        // 3秒后隐藏消息
        setTimeout(() => {
            messageEl.style.display = 'none';
        }, 3000);
    }
});

// import "./login01.less"